<template>
  <div>
    <!-- 面包屑导航区域 -->
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>商品管理</el-breadcrumb-item>
      <el-breadcrumb-item>商品分类</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card>
      <!-- 添加分类按钮 -->
      <el-button type="primary">添加分类</el-button>
      <!-- 表格区域 -->
      <el-table
        :tree-props="{children: 'children'}"
        row-key="cat_id"
        border
        stripe
        :data="cateList"
      >
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column label="分类名称" prop="cat_name"></el-table-column>
        <el-table-column label="是否有效" prop="cat_name"></el-table-column>
        <el-table-column label="排序" prop="cat_level"></el-table-column>
        <el-table-column label="操作"></el-table-column>
      </el-table>
      <!-- 分页器 -->
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      cateList: [],
      queryInfo: {
        type: [3],
        pagenum: 1,
        pagesize: 5
      }
    }
  },
  methods: {
    async getCateList() {
      const { data: res } = await this.$http.get('categories/', {
        params: this.queryInfo
      })
      this.cateList = res.data.result
      console.log(this.cateList)
    }
  },
  created() {
    this.getCateList()
  }
}
</script>

<style lang="less" scoped>
</style>
